package com.example.administrator.kotlin

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import com.example.administrator.kotlin.activity.*
import com.example.administrator.kotlin.bean.Person
import kotlinx.android.synthetic.main.activity_main.*
import org.jetbrains.anko.onClick
import org.jetbrains.anko.startActivity

class IndexActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val persion = Person("luo",26);

        btn.text = "常用首页布局"
        btn.onClick { view ->

            //            val intent = Intent(this@IndexActivity, RecyclerViewActivity::class.java)
            //            intent.putExtra("key",System.currentTimeMillis().toString())
            //            startActivity(intent)
            startActivity<MainActivity>("key" to "fsadf")
        }

        btn2.onClick { view ->
            startActivity<ViewPagerActivity>()
        }

        //经典使用
        btn3.onClick { startActivity<BrvahActivity>() }

        //多条目adapter
        btn4.onClick { startActivity<MultiItemActivity>() }

        //瀑布流
        btn5.onClick { startActivity<StaggerActivity>() }


//        imageview.onClick { view ->
//            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
//                val options = ActivityOptionsCompat.makeSceneTransitionAnimation(this@IndexActivity, imageview, imageview.transitionName)
//                startActivity(Intent(this@IndexActivity, MainActivity::class.java), options.toBundle())
//            } else {
//                startActivity(Intent(this@IndexActivity, MainActivity::class.java))
//            }
//
//        }

        btn6.onClick { startActivity<LinearHoriActivity>() }

        btn_bilibili_home.onClick { startActivity<BiliBiliActivity>() }

    }
}
